<template>
  <simple-select :data-list="rolelist" v-model="role" :style="{width: '100%'}" v-on="$listeners" v-bind="$attrs" v-if="loading"></simple-select>
</template>
<script>
  import SimpleSelect from './SimpleSelect'
  import role from "@/api/systemManagement/role/index";
  export default {
    name:"RoleSelect",
    components: { SimpleSelect },
    props:["value"],
    data(){
      return {
        rolelist:[],
        loading:false
      }
    },
    created() {
      this.getRoleList()

    },
    computed:{
      role:{
        get(){
          return this.value
        },
        set(v){
          this.$emit("input",v)
        }
      }
    },
    methods:{
      getRoleList() {
        role.getSimpleList().then(res => {
          this.rolelist = res.data;
          this.loading = true
          console.log("----------------this.role",this.role)
          console.log("----------------this.rolelist",this.rolelist)
        })
      },
    }
  }
</script>
